import React from 'react'
import "../css/borard.css"
import EventEmitter from "../event"
class Borard extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            messages: []
        }
    }

    render() {
        return (
            <div className="top">
                {
                    this.state.messages.map((element, index) => {
                        return <div className="content" key={index}>
                            <h3>{element.content}</h3>
                            <h3>{element.data}</h3>
                        </div>
                    })
                }
            </div>


        )
    }
    
    componentDidMount() {
        EventEmitter.addListener("sendss", (message) => {
            console.log(message);
            this.state.messages.push(message);
            this.setState({
                message: this.state.messages
            })
        })
    }
}

export default Borard